package com.tmall.tmall.mapper;

import com.tmall.tmall.pojo.MainCategory;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface MainCategoryMapper {
    List<MainCategory> page(String name);
    
    @Select("select * from main_category where delete_at is null and name=#{name}")
    MainCategory getByName(String name);

    @Insert("insert into main_category (name) value (#{name})")
    void insert(MainCategory mainCategory);
    
    @Select("select * from main_category where delete_at is null and id=#{id}")
    MainCategory getById(Integer id);

    void update(MainCategory mainCategory);

    @Select("select * from main_category where delete_at is null ")
    List<MainCategory> selectAll();
}
